using System;
using System.Drawing;
using System.ComponentModel;

namespace Camalon.Drawing
{
	

	[Serializable]
	[TypeConverter(typeof(ScaleConverter))]
	public struct Scale
	{
		private int		_x;
		private int		_y;
		private bool	_appendRotate;

		public Scale( int x, int y, bool appendRotate )
		{
			_x				= x;
			_y				= y;
			_appendRotate	= appendRotate;
		}

		public Scale( int x, int y )
		{
			_x				= x;
			_y				= y;
			_appendRotate	= false;
		}

		public Scale(Scale scale)
		{
			_x				= scale.X;
			_y				= scale.Y;
			_appendRotate	= scale.AppendRotate;
		}

		#region operatoren
		public override bool Equals(object obj)
		{
			if(!( obj is Scale)) return false;

			return  this == (Scale)obj;
		}

		public bool Equals(Scale value)
		{
			return  this == value;
		}

		public override int GetHashCode()
		{
			return _x.GetHashCode()^_y.GetHashCode()^_appendRotate.GetHashCode();
		}

		public static bool operator ==(	Scale value1,Scale value2	)
		{
			return value1._x == value2._x && value1._y == value2._y && value1._appendRotate == value2._appendRotate;
		}

		public static bool operator !=(	Scale value1,Scale value2	)
		{
			return !(value1== value2);
		}
		#endregion operatoren

		public static Scale Empty
		{
			get{ return new Scale(0,0);}
		}

		[Browsable(false)]
		public bool IsEmpty
		{
			get{ return _x == 0 && _y == 0;}
		}



		[DefaultValue( 0 )]
		public int X
		{
			get{ return _x;  }
			set
			{ 
				//value = (float)System.Math.Round( value, 3 );
				//if( value < 0) throw new ArgumentException("The scaling X value  must be greater than or equal to zero");
				_x = value;
			}
		}

		[DefaultValue( 0 )]
		public int Y
		{
			get{ return _y;  }
			set
			{ 
				//value = (float)System.Math.Round( value, 3 );
				//if( value < 0) throw new ArgumentException("The scaling Y value  must be greater than zero");
				_y = value;
			}
		}

		[DefaultValue( false )]
		public bool AppendRotate
		{
			get{ return _appendRotate;}
			set{ _appendRotate = value;}
		}

	}



}
